package ${content.items.model.packageName};
<#assign assign_ClassName = content.items.model.className>
<#assign assign_EntityName = content.items.entity.className>
<#assign assign_daoName = content.items.dao.camelName>
<#assign tableName = content.content.tableName>
<#assign tableRemark = content.content.remark>
<#assign camelName = content.content.camelName>

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

import ${content.items.dao.packageName}.${content.items.dao.className};
import ${content.items.entity.packageName}.${content.items.entity.className};

/**
 * ${tableName}${tableRemark}数据
 * @author liuyandeng
 *
 */
@Component(value = "${content.items.model.className?uncap_first}")
public class ${assign_ClassName}  {
	private static Logger log = LoggerFactory.getLogger(${assign_ClassName}.class);
	@Resource
	private ${content.items.dao.className} writeDao;


	//获取${tableRemark}列表
    public List<${assign_EntityName}> get${assign_EntityName}List(Map<String, String> queryMap, Integer start, Integer size) {
		return writeDao.getList(queryMap, start, size);
	}

	//获取${tableRemark}数量
	public Integer get${assign_EntityName}Count(Map<String, String> queryMap) {
		return writeDao.getCount(queryMap);
	}


<#if content.content.primaryField??>
	<#assign assign_idFieldType = content.content.primaryField[0].fieldType>
	<#assign assign_idFieldName = content.content.primaryField[0].fieldName>

	//获取${tableRemark}详情
	public ${assign_EntityName} get${camelName?cap_first}ById(${assign_idFieldType} ${assign_idFieldName}){
		${assign_EntityName} ${camelName}=writeDao.get(${assign_idFieldName});
		return  ${camelName};
	}

	//保存${tableRemark}
	@Transactional
	public Integer save${camelName?cap_first}(${assign_EntityName} ${camelName}) {
		return writeDao.insert(${camelName});
	}

	//更新${tableRemark}
	@Transactional
	public Integer update${camelName?cap_first}(${assign_EntityName} ${camelName}) {
		return writeDao.update(${camelName});
	}

	//删除${tableRemark}
	@Transactional
	public Integer delete${camelName?cap_first}(${assign_idFieldType} ${assign_idFieldName}){
		return writeDao.delete(${assign_idFieldName});
	}
</#if>

}
